# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
# Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
pkgname=py3-voluptuous
_pkgname=voluptuous
pkgver=0.14.2
pkgrel=1
pkgdesc="Python data validation library"
url="https://github.com/alecthomas/voluptuous"
license="BSD-3-Clause"
arch="noarch"
depends="python3"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir"/$_pkgname-$pkgver

replaces="py-voluptuous" # Backwards compatibility
provides="py-voluptuous=$pkgver-r$pkgrel" # Backwards compatibility

prepare() {
	default_prepare
	# https://github.com/alecthomas/voluptuous/issues/333
	rm -rf ./*.egg-info
}

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest voluptuous/tests/tests.py
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
1e126fe659e5c2c017bb13f19c2026e203d2cdcf3b5ed5946375e5f879b9f0965544e94c63adfa7aa12facde48ff1b6c7286000ea5434ccbb8247d399d500dfc  voluptuous-0.14.2.tar.gz
"
